<?php defined('SYSPATH') or die('No direct script access.') ?>
 <div class="row">
      <div class="col-md-2 col-xs-2 col-sm-2">
<h5>Статус заявки</h5>

<div class="btn-group-vertical" data-toggle="buttons">
    <!--<label class="btn btn-info"><input type="radio" name="options" id="option1">В работе</label>-->
    <label class="btn btn-success" data-toggle="modal" href="#comein"><input type="radio">Запись</label>
    <label class="btn btn-info" data-toggle="modal" href="#agreement"><input type="radio">Согласовать</label>
    <label class="btn btn-warning" data-toggle="modal" href="#recall"><input type="radio">Перезвонить</label>
    <label class="btn btn-danger"><input type="radio" name="options" id="option3">Недозвон</label>
    <label class="btn btn-danger"><input type="radio" name="options" id="option3">Неверный №</label>
    <label class="btn btn-danger"><input type="radio" name="options" id="option3">Регион</label>
</div>
<!--
        <p><input class="form-control" type="text"></p>
        <p><input class="form-control" type="text"></p>
        <p><input class="form-control" type="text"></p>
        <p><input class="form-control" type="text"></p>
        <p><input class="form-control" type="text"></p>
        <p><input class="form-control" type="text"></p>
        <p><input class="form-control" type="text"></p>
      </div>
      <div class="col-md-10">
        <h4>Some Input</h4>
        <p><input class="form-control" type="text"></p>
        <p><input class="form-control" type="text"></p>
        <p><input class="form-control" type="text"></p>
        <p><input class="form-control" type="text"></p>
        <p><input class="form-control" type="text"></p>
        <p><input class="form-control" type="text"></p>
        <p><input class="form-control" type="text"></p>-->
      </div>
      <div class="col-md-10 col-xs-10 col-sm-10">
<?php
echo Form::open($controller.'/'.$action.'/short/'.$id, array('id'=>'card_form','class'=>'form-horizontal','role'=>'form'));
?>
 <div class="form-group">
      <div class="col-md-8 col-xs-8 col-sm-8">
      <input type="text" class="form-control" id="name" name="name" placeholder="Фамилия Имя Отчество" value="<?php echo $lead['name'] ?>">
    </div>
     <div class="col-md-4 col-xs-4 col-sm-4">
      <input type="text" class="form-control" id="phone" name="phone" placeholder="Телефон" value="<?php echo $lead['phone'] ?>">
    </div>
  </div>

      <textarea class="form-control" rows="4" name="leadstext"><?php echo $lead['leadstext'] ?></textarea>

  <h4>Дополнительная информация</h4>
<div class="row">
   <div class="col-md-4 col-xs-4 col-sm-4">
<?php
if (!empty($additional[0]))
{ 
	foreach($additional[0] as &$row)
	{
?>
		<div class="checkbox"><label><input type="checkbox" value="<?php echo htmlspecialchars($row['additionaltext']).'">'.htmlspecialchars($row['additionaltext']) ?></label></div>
<?php 
	}
}
?>
	</div>
	<div class="col-md-4 col-xs-4 col-sm-4">
<?php
if (!empty($additional[1]))
{ 
	foreach($additional[1] as &$row)
	{
?>
		<div class="checkbox"><label><input type="checkbox" value="<?php echo htmlspecialchars($row['additionaltext']).'">'.htmlspecialchars($row['additionaltext']) ?></label></div>
<?php 
	}
}
?>
	</div>
	<div class="col-md-4 col-xs-4 col-sm-4">
<?php
if (!empty($additional[2]))
{ 
	foreach($additional[2] as &$row)
	{
?>
		<div class="checkbox"><label><input type="checkbox" value="<?php echo htmlspecialchars($row['additionaltext']).'">'.htmlspecialchars($row['additionaltext']) ?></label></div>
<?php 
	}
}
?>
	</div>
</div>	
<h4>Тематика</h4>
<div class="row">
	<div class="col-md-3 col-xs-3 col-sm-3">
<?php
if (!empty($subjects[0]))
{ 
	foreach($subjects[0] as &$row)
	{
?>
		<div class="checkbox"><label><input type="checkbox" value="<?php echo htmlspecialchars($row['subjectstext']).'">'.htmlspecialchars($row['subjectstext']) ?></label></div>
<?php 
	}
}
?>
	</div>
	<div class="col-md-3 col-xs-3 col-sm-3">
<?php
if (!empty($subjects[1]))
{ 
	foreach($subjects[1] as &$row)
	{
?>
		<div class="checkbox"><label><input type="checkbox" value="<?php echo htmlspecialchars($row['subjectstext']).'">'.htmlspecialchars($row['subjectstext']) ?></label></div>
<?php 
	}
}
?>
	</div>
	<div class="col-md-3 col-xs-3 col-sm-3">
<?php
if (!empty($subjects[2]))
{ 
	foreach($subjects[2] as &$row)
	{
?>
		<div class="checkbox"><label><input type="checkbox" value="<?php echo htmlspecialchars($row['subjectstext']).'">'.htmlspecialchars($row['subjectstext']) ?></label></div>
<?php 
	}
}
?>
	</div>
	<div class="col-md-3 col-xs-3 col-sm-3">
<?php
if (!empty($subjects[3]))
{ 
	foreach($subjects[3] as &$row)
	{
?>
		<div class="checkbox"><label><input type="checkbox" value="<?php echo htmlspecialchars($row['subjectstext']).'">'.htmlspecialchars($row['subjectstext']) ?></label></div>
<?php 
	}
}
?>
	</div>
</div>
<!--
<button type="button" class="btn btn-default btn-xs btn-block" data-toggle="button">на машине</button>
<button type="button" class="btn btn-default btn-xs btn-block" data-toggle="button">возьмет деньги для аванса</button>-->
<!--//  </div>//-->

 </form>
 </div>
 </div>
 <!--//
    <p>This modal will resize itself to the same dimensions as the container class.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis sollicitudin ipsum ac ante fermentum suscipit. In ac augue non purus accumsan lobortis id sed nibh. Nunc egestas hendrerit ipsum, et porttitor augue volutpat non. Aliquam erat volutpat. Vestibulum scelerisque lobortis pulvinar. Aenean hendrerit risus neque, eget tincidunt leo. Vestibulum est tortor, commodo nec cursus nec, vestibulum vel nibh. Morbi elit magna, ornare placerat euismod semper, dignissim vel odio. Phasellus elementum quam eu ipsum euismod pretium.</p>
//-->

<div id="comein" class="modal fade" tabindex="-1" data-focus-on="input:first" style="display: none;">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h4 class="modal-title">Календарь записи с <?php echo date("d.m.Y", strtotime("Monday this week")).' по '.date("d.m.Y", strtotime("Sunday")) ?></h4>
  </div>
  <div class="modal-body">

<?php
echo Form::open($controller.'/'.$action.'/short/'.$id, array('id'=>'comein_form','class'=>'form-horizontal','role'=>'form'));
?>

 <div class="row show-grid">
      <div class="col-xs-3 col-sm-3 col-md-3 borderr">&nbsp;</div>
      <div class="col-xs-1 col-sm-1 col-md-1 bordert">пн</div>
      <div class="col-xs-1 col-sm-1 col-md-1 bordert">вт</div>
      <div class="col-xs-1 col-sm-1 col-md-1 bordert">ср</div>
      <div class="col-xs-1 col-sm-1 col-md-1 bordert">чт</div>
      <div class="col-xs-1 col-sm-1 col-md-1 bordert">пт</div>
      <div class="col-xs-1 col-sm-1 col-md-1 bordert">сб</div>
      <div class="col-xs-1 col-sm-1 col-md-1 bordert">вс</div>

 </div>
 <div class="row show-grid">
      <div class="col-xs-3 col-sm-3 col-md-3 borderr">время</div>
<?php
	for($j=strtotime("Monday this week");$j<=strtotime("Sunday");$j=$j+86400)
	{
?>
      <div class="col-xs-1 col-sm-1 col-md-1 border"><small><?php echo date('d.m',$j) ?></small></div>
<?php
    }
?>
 </div>
<?php
for($i=$worktime['start'];$i<=$worktime['end'];$i++)
{
?>
  <div class="row show-grid">
      <div class="col-xs-3 col-sm-3 col-md-3 borderr"><?php echo date('H:i',strtotime("Today")+$i*3600) ?></div>
<?php
	for($j=strtotime("Monday this week");$j<=strtotime("Sunday");$j=$j+86400)
	{
?>
      <div id="cal_<?php echo ($i*3600+$j) ?>" class="col-xs-1 col-sm-1 col-md-1 border<?php echo $im==$i*3600+$j?' im':'' ?>"><?php echo !empty($calendar[$i*3600+$j])?$calendar[$i*3600+$j]:'&nbsp;' ?></div>
<?php
    }
?>
 </div>
<?php
}
?>

 </form>
  </div>
  <div class="modal-footer">
    <button type="button" data-dismiss="modal" class="btn btn-default">Закрыть</button>
    <button type="button" class="btn btn-primary" id="comein_submit">Сохранить изменения</button>
  </div>
</div>

<div id="agreement" class="modal fade" tabindex="-1" data-focus-on="input:first" style="display: none;">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h4 class="modal-title">Календарь согласования с <?php echo date("d.m.Y", strtotime("Monday this week")).' по '.date("d.m.Y", strtotime("Sunday")) ?></h4>
  </div>
  <div class="modal-body">

<?php
echo Form::open($controller.'/'.$action.'/short/'.$id, array('id'=>'agreement_form','class'=>'form-horizontal','role'=>'form'));
?>

 <div class="row show-grid">
      <div class="col-xs-3 col-sm-3 col-md-3 borderr">&nbsp;</div>
      <div class="col-xs-1 col-sm-1 col-md-1 bordert">пн</div>
      <div class="col-xs-1 col-sm-1 col-md-1 bordert">вт</div>
      <div class="col-xs-1 col-sm-1 col-md-1 bordert">ср</div>
      <div class="col-xs-1 col-sm-1 col-md-1 bordert">чт</div>
      <div class="col-xs-1 col-sm-1 col-md-1 bordert">пт</div>
      <div class="col-xs-1 col-sm-1 col-md-1 bordert">сб</div>
      <div class="col-xs-1 col-sm-1 col-md-1 bordert">вс</div>

 </div>
 <div class="row show-grid">
      <div class="col-xs-3 col-sm-3 col-md-3 borderr">время</div>
<?php
	for($j=strtotime("Monday this week");$j<=strtotime("Sunday");$j=$j+86400)
	{
?>
      <div class="col-xs-1 col-sm-1 col-md-1 border"><small><?php echo date('d.m',$j) ?></small></div>
<?php
    }
?>
 </div>
<?php
for($i=$worktime['start'];$i<=$worktime['end'];$i++)
{
?>
  <div class="row show-grid">
      <div class="col-xs-3 col-sm-3 col-md-3 borderr"><?php echo date('H:i',strtotime("Today")+$i*3600) ?></div>
<?php
	for($j=strtotime("Monday this week");$j<=strtotime("Sunday");$j=$j+86400)
	{
?>
      <div id="cal_<?php echo ($i*3600+$j) ?>" class="col-xs-1 col-sm-1 col-md-1 border<?php echo $im==$i*3600+$j?' im':'' ?>"><?php echo !empty($calendar[$i*3600+$j])?$calendar[$i*3600+$j]:'&nbsp;' ?></div>
<?php
    }
?>
 </div>
<?php
}
?>

 </form>
  </div>
  <div class="modal-footer">
    <button type="button" data-dismiss="modal" class="btn btn-default">Закрыть</button>
    <button type="button" class="btn btn-primary" id="agreement_submit">Сохранить изменения</button>
  </div>
</div>

<div id="recall" class="modal fade" tabindex="-1" data-focus-on="input:first" style="display: none;">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h4 class="modal-title">Календарь перезвона с <?php echo date("d.m.Y", strtotime("Monday this week")).' по '.date("d.m.Y", strtotime("Sunday")) ?></h4>
  </div>
  <div class="modal-body">

<?php
echo Form::open($controller.'/'.$action.'/short/'.$id, array('id'=>'recall_form','class'=>'form-horizontal','role'=>'form'));
?>

 <div class="row show-grid">
      <div class="col-xs-3 col-sm-3 col-md-3 borderr">&nbsp;</div>
      <div class="col-xs-1 col-sm-1 col-md-1 bordert">пн</div>
      <div class="col-xs-1 col-sm-1 col-md-1 bordert">вт</div>
      <div class="col-xs-1 col-sm-1 col-md-1 bordert">ср</div>
      <div class="col-xs-1 col-sm-1 col-md-1 bordert">чт</div>
      <div class="col-xs-1 col-sm-1 col-md-1 bordert">пт</div>
      <div class="col-xs-1 col-sm-1 col-md-1 bordert">сб</div>
      <div class="col-xs-1 col-sm-1 col-md-1 bordert">вс</div>

 </div>
 <div class="row show-grid">
      <div class="col-xs-3 col-sm-3 col-md-3 borderr">время</div>
<?php
	for($j=strtotime("Monday this week");$j<=strtotime("Sunday");$j=$j+86400)
	{
?>
      <div class="col-xs-1 col-sm-1 col-md-1 border"><small><?php echo date('d.m',$j) ?></small></div>
<?php
    }
?>
 </div>
<?php
for($i=$worktime['start'];$i<=$worktime['end'];$i++)
{
?>
  <div class="row show-grid">
      <div class="col-xs-3 col-sm-3 col-md-3 borderr"><?php echo date('H:i',strtotime("Today")+$i*3600) ?></div>
<?php
	for($j=strtotime("Monday this week");$j<=strtotime("Sunday");$j=$j+86400)
	{
?>
      <div id="cal_<?php echo ($i*3600+$j) ?>" class="col-xs-1 col-sm-1 col-md-1 border<?php echo $im==$i*3600+$j?' im':'' ?>"><?php echo !empty($calendar[$i*3600+$j])?$calendar[$i*3600+$j]:'&nbsp;' ?></div>
<?php
    }
?>
 </div>
<?php
}
?>

 </form>
  </div>
  <div class="modal-footer">
    <button type="button" data-dismiss="modal" class="btn btn-default">Закрыть</button>
    <button type="button" class="btn btn-primary" id="recall_submit">Сохранить изменения</button>
  </div>
</div>